package com.letoken.platform.admin.util;

import org.springframework.util.StringUtils;

public enum EnumUploadType {

    USER_UP_TYPE_1(1, "category","leTokenAdmin/uploadRes/category/",null,true,null,null),
    USER_UP_TYPE_2(2, "token","leTokenAdmin/uploadRes/token/",null,true,null,null),

    USER_UP_TYPE_3(3, "banner ","leTokenAdmin/uploadRes/banner/",null,true,null,null),
    USER_UP_TYPE_4(4, "cap挖矿logo  ","leTokenAdmin/uploadRes/cap/logo",null,true,null,null),
    USER_UP_TYPE_5(5, "cap挖矿banner ","leTokenAdmin/uploadRes/cap/banner/",null,true,null,null),

    ;

    private Integer code;
    private String desc;
    private String dir;
    private Integer maxSize;
    private Boolean isImage;
    private Integer minWidth;
    private String rate;

    public static EnumUploadType getType(Integer type){
        EnumUploadType[] types = EnumUploadType.values();
        for (EnumUploadType enumUploadType : types) {
            if(enumUploadType.code.equals(type) && StringUtils.hasLength(enumUploadType.dir)){
                return enumUploadType;
            }
        }
        throw new RuntimeException("文件类型错误");
    }


    EnumUploadType(Integer code, String desc, String dir, Integer maxSize, Boolean isImage, Integer minWidth, String rate) {
        this.code = code;
        this.desc = desc;
        this.dir = dir;
        this.maxSize = maxSize;
        this.isImage = isImage;
        this.minWidth = minWidth;
        this.rate = rate;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public Integer getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(Integer maxSize) {
        this.maxSize = maxSize;
    }

    public Boolean getIsImage() {
        return isImage;
    }

    public void setIsImage(Boolean image) {
        isImage = image;
    }

    public Integer getMinWidth() {
        return minWidth;
    }

    public void setMinWidth(Integer minWidth) {
        this.minWidth = minWidth;
    }

    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }
}
